﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
   public  class letter
    {
       iDAC DAC = DACFactory.GetDAC();
       private long _n_id = -99;
       private string _n_name = "";
       private string _n_letter = "";
       private bool _isdeleted = false;
       public long n_id
       {
           get { return _n_id; }
           set { _n_id = value; }
       }
       public string n_name
       {
           get { return _n_name; }
           set { _n_name = value; }
       }
       public string n_letter
       {
           get { return _n_letter; }
           set { _n_letter = value; }
       }
       public bool isdeleted
       {
           get { return _isdeleted; }
           set { _isdeleted = value; }
       }
       public long SaveRecords()
       {
           try
           {
               DbParameter dbparam0=DAC.Parameter("@n_id",n_id,DbType.Int64,ParameterDirection.Input);
               DbParameter dbparam1=DAC.Parameter("@n_name",n_name,DbType.AnsiString,ParameterDirection.Input);
               DbParameter dbparam2=DAC.Parameter("@n_letter",n_letter,DbType.AnsiString,ParameterDirection.Input);
               DbParameter dbparam3=DAC.Parameter("@isdeleted",isdeleted,DbType.Boolean,ParameterDirection.Input);
               DbParameter[] dbparamcall=new DbParameter[]{dbparam0,dbparam1,dbparam2,dbparam3};
               return DAC.Save("newsletter_save",dbparamcall);
           }
           catch(Exception ex)
           {
               //return Result=-99;
           }
           return -99;

       }
       public DataTable GetRecords(long n_id, string n_name, string n_letter, bool isdeleted, string paraandor)
       {

           try
           {
               DbParameter dbparam0 = DAC.Parameter("@n_id", n_id, DbType.Int64, ParameterDirection.Input);
               DbParameter dbparam1 = DAC.Parameter("@n_name", n_name, DbType.AnsiString, ParameterDirection.Input);
               DbParameter dbparam2 = DAC.Parameter("@n_letter", n_letter, DbType.AnsiString, ParameterDirection.Input);
               DbParameter dbparam3 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
               DbParameter dbparam4 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
               DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
               DataTable dt = DAC.Select("newsletter_get", dbparamcall);
               return dt;
           }
           catch (Exception ex)
           {
               //return Result = -99;
           }
           return null;
       }
    }
}
